package util;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 类名：AlipayConfig
 * 功能：基础配置类
 * 详细：设置商家账户有关信息及通知返回路径，暂时以沙箱应用用户的基础信息为准。
 *
 * @author dsf
 */
public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016081600254601";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCWnT1B+ucg6MdAZWb6c/U31nSSZZR5tYFD3sgTrDccCFLJ7nG+Ff2jv6bOINRrAEXlM7Qg9xtjr/WDYMSuY2TXeTKnxPwPEMqfOLE0uK+sMC0Fks+vfdr1eJCpfmEVKT9WZRgWCXR02bCt1Bg1f04eZbGts19U5qS1TVQXY+Ktch2wdWBnGYOIwAsKWM6dPSbQKx+/y3BpKv4CQhGtK1SDgMzBSvt8uNcXuR3WTydJd+sijFSxfXhRXxGPFhaAe6Xm33YcdiPaB8Ev0QUIhSE2ArpyJ0a9qTGjPOZpuhOobZPRoKLyNb6ikacyhOBzpLrCj/6j1aB+k9DucjJopQaLAgMBAAECggEARs73zLxDy1IE0v6ZUmgPwkedmHIPQsUVV642TCFr607ydSMX8HDwRPrGViRTGVcQhTgwmEr0YoKIH1LwRLhP4YmGSh+vDPos+Hwzu4CUfpRLplImN/Aob71V7YmP5N32fAydLUcWrBToHmEXXJdUR7Axv2MUD5s7lk0bmr+IA1hnUYvsu1iGwQX1trmnuVyqKYo9V7XmiqBJA0Lj2UF65yaAIQTqshoTjacK72RPdBYdTgblIYp8SwNjId1GeiHhTG/r0mnqnO6ke0wXmRKigsIug6ZoJhEJt6sQH1IMCek1QeEykFtoBfmArCmMaB/LGufBIZAJHxHHNrcnzHpCMQKBgQDk+ym9HQ8Q597ujkye26vF69xt/o/+B3NoIckOqDUVpG6+zxtVrS0sqrZsJ5kwiEG8ocU8UxJ/4PUZp1eLDM/cmvz9vGz+HRm/MbrpzyayGfSqS0FMhZdeOUpRdgTVAUVRW2YAgRPhBPr4fQoOYSwQQ9Rice/GPQ8w8K+RhIk/CQKBgQCoYtiTjN2fE1WX6ck/bR1kh4Mj1X7DEDXDwuk8nT3MicL0AHwsYw1cAqdo2lid34AiY0NzVD4r1S0sGTpInxTFkCwVVRhm6bHqabI2Inn22q0ZGhIByuqaJxBv00+VpUcGgWAlDOeJCbbD7qI1H4XO+Qv0hbTgEjekbqw3MMfp8wKBgBpQ818Us+KRg4GPQScQwBEjJlZN52aenJjfKShSFKfEGiY7zzxthr+XbxfHBUgaoNN5FB32vi2MQR8NqHYGpu0HswPGYBBkb80VfhHZCO13JjNcKskMoXTmyK/MDIoed0T+aB6utwYpeF6OoFU+vb2wzfvydEgoRFKvlr32qX9hAoGAA7kTwsdliwPZa59upKlb8gIRAzTQNa3hEm/3yjBL0n7lQZHVLQIPpI4md2oEdZEgeyIotp8RNNTkx8nTARILWobigqI8BOJ73YvytcGzYqLZGun5pfJ/l2LvuRk59DwQQvOPVaJgaCY/1TssePI2eioFeqWOJzof4tHTmvDIKsMCgYATkpx6WFrnL6JNkhquDTn/s6eALxwkACeeWc+I75YFBAW41KZNXYj9y7ZaHdfoiuh1kUnu1EasMdBMsZJEiK5wlU2UO5zm+0M8R26EUgMSBAIoAoMtfwHzthIpmzbzBb7Emr4roVUbF1UrGHR8zcvqkOt7x1PqcIae7PYhgSZQWA==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm
    // 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuD0ENT0BQ8kPwc7gveie0RiJ2PGG5XIsvU6LVHp+8Ov/DK0O49fywWn68c1//tigiqzdc1KW3xj4V7ftLdMc4CH2MkraMGWWQFX2wet3w+jXu75xq+pmdCMTYXiikLxpXSutBS+krK/xdpbRx0VeN/DIdvA1lehSZsSQzW/+sOw2Mgvl278myEQDzRJbeAdJ3DL7tDXNwf5feQdoenwiL+KcXl6ILRmHa4c7qZmFc24QytolkiNCk2ixRRo2Mma2KEXV/gUgxiffI8adZ9HXbcK8u/Jlz3GctkItMg6w03I2bfnbq+UaZC1UFnnzPTXPhoWEYjvZomdDKKR2JOPsvQIDAQAB";

    //TODO 部署是修改以下异步通知&同步通知对应的url
    // 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "  http://115.159.92.47:8080/notify";
//    public static String notify_url = "   http://74yihz.natappfree.cc/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "  http://115.159.92.47:8080/rechargeReturn";
//    public static String return_url = "   http://74yihz.natappfree.cc/rechargeReturn";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "./";

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
